﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Student stu = new Student();
            Tiger t = new Tiger();
            t.Leg = 4;
            t.Sleep();
            t.Walk();
            t.Eat();
            t.Cry();
            t.SeeInNight();

            Console.WriteLine("--------------------");
            Cat c = new Cat();
            c.Leg = 4;
            c.Sleep();
            c.Walk();
            c.Eat();
            c.Cry();
            c.SeeInNight();
            c.CatchMouse();

            Console.WriteLine("--------------------");
            Eagle e = new Eagle();
            e.Leg = 2;
            e.Sleep();
            e.Walk();
            e.Eat();
            e.Cry();

            Console.WriteLine("--------------------");
            Swallow s = new Swallow();
            s.Leg = 2;
            s.Sleep();
            s.Walk();
            s.Eat();
            s.Cry();
            s.FlyToSouth();

            //宠物给宠物店寄存
            Cat tom = new Cat();
            PetStore ps = new PetStore();
            //ps.ConsignCat(tom);
            ps.ConsignAnimal(tom);

            Console.WriteLine("------------------------------------");

            Tiger t = new Tiger();
            //ps.ConsignTiger(t);
            ps.ConsignAnimal(t);

            Console.WriteLine("------------------------------------");
            Eagle e = new Eagle();
            //ps.ConsignEagle(e);
            ps.ConsignAnimal(e);

            Console.WriteLine("------------------------------------");
            Swallow s = new Swallow();
            //ps.ConsignSwallow(s);
            ps.ConsignAnimal(s);

            Console.WriteLine("------------------------------------");
            Lion l = new Lion();
            ps.ConsignAnimal(l);

            Console.WriteLine("------------------------------------");
            //实现多态的条件：1、继承；  2、重写；  3、父类的引用指向子类的实例

            Animal a = new Tiger();
            a.Cry();

        }
    }
}
